%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/interfaces-via-union-all/vulnerabilities"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 10, 12, 18, 47, 48, 11<br />2: PgUnionAll[8]<br />ᐳ: Access[46]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 18, 11<br /><br />ROOT __Item{1}ᐸ46ᐳ[14]"):::bucket
    Bucket2("Bucket 2 (polymorphic)<br />__typename: Access[21]<br />Deps: 21, 11, 22"):::bucket
    Bucket3("Bucket 3 (polymorphicPartition)<br />|FirstPartyVulnerability<br />Deps: 11, 22<br />ᐳFirstPartyVulnerability<br /><br />1: PgSelect[23]<br />2: PgSelectRows[28]<br />ᐳ: 27, 29, 38, 40, 42, 44"):::bucket
    Bucket4("Bucket 4 (polymorphicPartition)<br />|ThirdPartyVulnerability<br />Deps: 11, 22<br />ᐳThirdPartyVulnerability<br /><br />1: PgSelect[31]<br />2: PgSelectRows[36]<br />ᐳ: 35, 37, 39, 41, 43, 45"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3 & Bucket4

    %% plan dependencies
    PgUnionAll8[["PgUnionAll[8∈0] ➊<br />ᐸFirstPartyVulnerability,ThirdPartyVulnerabilityᐳ<br />More deps:<br />- Object[11]<br />- Constantᐸ6ᐳ[12]<br />- Constantᐸ3ᐳ[47]<br />- Constantᐸ1ᐳ[48]"]]:::plan
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 3"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    Access46{{"Access[46∈0] ➊<br />ᐸ8.itemsᐳ"}}:::plan
    PgUnionAll8 --> Access46
    List19{{"List[19∈1]<br />ᐸ16,17,18ᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[18]"}}:::plan
    Access16{{"Access[16∈1]<br />ᐸ14.0ᐳ"}}:::plan
    Access17{{"Access[17∈1]<br />ᐸ14.1ᐳ"}}:::plan
    Access16 & Access17 --> List19
    __Item14[/"__Item[14∈1]<br />ᐸ46ᐳ"\]:::itemplan
    Access46 ==> __Item14
    __Item14 --> Access16
    __Item14 --> Access17
    Lambda20{{"Lambda[20∈1]<br />ᐸtoSpecifierᐳ"}}:::plan
    List19 --> Lambda20
    Access21{{"Access[21∈1]<br />ᐸ20.__typenameᐳ"}}:::plan
    Lambda20 --> Access21
    Access22{{"Access[22∈1]<br />ᐸ20.idᐳ"}}:::plan
    Lambda20 --> Access22
    PgSelect23[["PgSelect[23∈3]<br />ᐸfirst_party_vulnerabilitiesᐳ<br />ᐳFirstPartyVulnerability<br />More deps:<br />- Object[11]"]]:::plan
    Access22 --> PgSelect23
    First27{{"First[27∈3]^"}}:::plan
    PgSelectRows28[["PgSelectRows[28∈3]^"]]:::plan
    PgSelectRows28 --> First27
    PgSelect23 --> PgSelectRows28
    PgSelectSingle29{{"PgSelectSingle[29∈3]^<br />ᐸfirst_party_vulnerabilitiesᐳ"}}:::plan
    First27 --> PgSelectSingle29
    PgClassExpression38{{"PgClassExpression[38∈3]^<br />ᐸ__first_pa...vss_score”ᐳ"}}:::plan
    PgSelectSingle29 --> PgClassExpression38
    PgClassExpression40{{"PgClassExpression[40∈3]^<br />ᐸ__first_pa...ies__.”id”ᐳ"}}:::plan
    PgClassExpression38 o--o PgClassExpression40
    PgClassExpression42{{"PgClassExpression[42∈3]^<br />ᐸ__first_pa...s__.”name”ᐳ"}}:::plan
    PgClassExpression40 o--o PgClassExpression42
    PgClassExpression44{{"PgClassExpression[44∈3]^<br />ᐸ__first_pa...team_name”ᐳ"}}:::plan
    PgClassExpression42 o--o PgClassExpression44
    PgSelect31[["PgSelect[31∈4]<br />ᐸthird_party_vulnerabilitiesᐳ<br />ᐳThirdPartyVulnerability<br />More deps:<br />- Object[11]"]]:::plan
    Access22 --> PgSelect31
    First35{{"First[35∈4]^"}}:::plan
    PgSelectRows36[["PgSelectRows[36∈4]^"]]:::plan
    PgSelectRows36 --> First35
    PgSelect31 --> PgSelectRows36
    PgSelectSingle37{{"PgSelectSingle[37∈4]^<br />ᐸthird_party_vulnerabilitiesᐳ"}}:::plan
    First35 --> PgSelectSingle37
    PgClassExpression39{{"PgClassExpression[39∈4]^<br />ᐸ__third_pa...vss_score”ᐳ"}}:::plan
    PgSelectSingle37 --> PgClassExpression39
    PgClassExpression41{{"PgClassExpression[41∈4]^<br />ᐸ__third_pa...ies__.”id”ᐳ"}}:::plan
    PgClassExpression39 o--o PgClassExpression41
    PgClassExpression43{{"PgClassExpression[43∈4]^<br />ᐸ__third_pa...s__.”name”ᐳ"}}:::plan
    PgClassExpression41 o--o PgClassExpression43
    PgClassExpression45{{"PgClassExpression[45∈4]^<br />ᐸ__third_pa...ndor_name”ᐳ"}}:::plan
    PgClassExpression43 o--o PgClassExpression45

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgUnionAll8,Access9,Access10,Object11,Access46 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item14,Access16,Access17,List19,Lambda20,Access21,Access22 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgSelect23,First27,PgSelectRows28,PgSelectSingle29,PgClassExpression38,PgClassExpression40,PgClassExpression42,PgClassExpression44 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgSelect31,First35,PgSelectRows36,PgSelectSingle37,PgClassExpression39,PgClassExpression41,PgClassExpression43,PgClassExpression45 bucket4

